<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>类的get和set</title>
</head>
<script>
    class Phone{
        get price(){
            console.log('价格优惠')
            return '799'
        }
        set price(price){
            console.log('价格被修改了')
        }
    }

    let phone = new Phone()
    console.log(phone.price)
    phone.price = 'free'
</script>
</html>